package client.rest;

import com.sun.jersey.api.client.ClientResponse;



public class MainTestRestfull {
	public static void main(String[] args) {
		JerseyClient client = null;
		
//		plainText
//		client = new JerseyClient("https://localhost:8443/rest-spring-cxf-ex/services/timeoftheday/asplaintext");
//		System.out.println("Plain Text=>> " + client.get_TEXT_PLAIN());
//		XML
		client = new JerseyClient("https://localhost:8888/rest-spring-cxf-ex/services/timeoftheday/asxml/ghgf");
		client.setUsernamePassword("admin", "123456");
		System.out.println("XML=>> " + client.get_XML(String.class));
		
		/*client = new JerseyClient("http://localhost:8080/rest-spring-cxf-ex/services/timeoftheday/asjson/lehuuthuy");
		client.setUsernamePassword("admin", "123456");
		System.out.println("JSON=>> " + client.get_JSON(String.class));*/
		
		
		//POST Method rest full
		/*client = new JerseyClient("http://localhost:8888/rest-spring-cxf-ex/services/timeoftheday/hello");
		client.setUsernamePassword("admin", "123456");
		ClientResponse response = client.postHelloMan("adfa");
		if (response.getStatus() != 201) {
			throw new RuntimeException("Failed : HTTP error code : "
			     + response.getStatus());
		}
		System.out.println("POST METHOD: Output from Server .... \n");
		String output = response.getEntity(String.class);
		System.out.println(output);*/
		
		client.close();
    }
}
